package com.kanq.controller;


import com.kanq.common.utils.CommonUtils;
import com.kanq.pojo.entity.KanqAiFileChunkKeywords;
import com.kanq.service.KanqAiFileChunkKeywordsService;
import com.kanq.tool.R;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/fileChunkKeywords")
@Slf4j
public class FileChunkKeywordsController {

    @Resource
    private KanqAiFileChunkKeywordsService kanqAiFileChunkKeywordsService;

    /**
     * 处理POST请求，添加关键字
     */
    @PostMapping("/add")
    public R add(@RequestBody KanqAiFileChunkKeywords kanqAiFileChunkKeywords) {
        return R.status(kanqAiFileChunkKeywordsService.save(kanqAiFileChunkKeywords));
    }

    /**
     * 删除关键字
     */
    @PostMapping("/remove")
    public R remove(@RequestParam String ids) {
        return R.status(kanqAiFileChunkKeywordsService.removeByIds(CommonUtils.idsStrToListSeparator(ids, ",")));
    }
}
